//店面管理-店面列表-配置文件
App.util.ns('Admin.Storefront.Storefront');
Admin.Storefront.Storefront.Conf = {
    columns: [
        {name: '名称', value: 'name'},
        {name: '地理位置', width: '300px',value: 'address'},
        {name: '状态', width: '80px',value: function(item){
            switch (item.status+'') {
                case '1':
                    return '上线';
                case '2':
                    return '下线';
            }
        }},
        {name: '创建日期', width: '80px', value: function(item){
            return App.util.formator.date(item.created_at);
        }}
    ],
    form: [
        {type: 'hidden', name: 'id'},
        {type: 'input', name: 'name', title: '名称', required: true, maxLength: 40, rule: {
            type: 'str',
            range: [1, 40]
        }},
        {type: 'img', name: 'imgs', title: '图集',rule: {
            type: 'str',
            range: [0, 255]
        }},
        [
            {type: 'input', name: 'lng', title: '经度', required: true,
                rule: {
                    type: 'str',
                    range: [1, 40]
                },
                onChange: function(self){
                    return ;
                    var rowsRaw = self.value();
                    var colsRaw = self.form.formItems['lat'].value();
                    var rows = rowsRaw ? parseInt(rowsRaw) : 0;
                    var cols = colsRaw ? parseInt(colsRaw) : 0;
                    self.form.formItems['lat'].change(rows*cols);
                }
            },
            {type: 'input', name: 'lat', title: '纬度', required: true,
                rule: {
                    type: 'int',
                    range: [1, 100]
                },
                onChange: function(self){
                    return ;
                    var rowsRaw = self.value();
                    var colsRaw = self.form.formItems['lat'].value();
                    var rows = rowsRaw ? parseInt(rowsRaw) : 0;
                    var cols = colsRaw ? parseInt(colsRaw) : 0;
                    self.form.formItems['lat'].change(rows*cols);
                }}
        ],
        {type: 'input', name: 'address', title: '地理位置', rule: {
            type: 'str',
            range: [0, 200]
        }}
    ]
};